package com.weiyuwqj.api.model.convert;

/**
 * Created by zhangyong on 2016/3/25.
 */
public class UserSexConvert extends DefaultConvert {
    @Override
    public Object convert(Object val) {
        if (val == null) return "";
        if (!(val instanceof String)) {
            return "";
        }
        String type = val.toString();
        if(type.isEmpty()){
           return "";
        }

        Integer sex = Integer.parseInt(type.substring(type.length() - 2, type.length() - 1));
        if (sex % 2 == 1) {
            return "男";
        } else if (sex % 2 == 0) {
            return "女";
        } else {
            return "其他";
        }

    }
}
